package gold.digger;

/**
 * Created by fanzhenyu02 on 2020/3/1.
 */
public class LC09 {
    public boolean isPalindrome(int x) {
        if (x < 0) {
            return false;
        }

        String num = String.valueOf(x);
        for (int i = 0, j = num.length() - 1; i <= num.length() / 2; ++i, --j) {
            if (num.charAt(i) != num.charAt(j)) {
                return false;
            }
        }

        return true;
    }

    public static void main(String[] args) {
        LC09 an = new LC09();
        System.out.println(an.isPalindrome(1221));
    }
}
